package br.com.sigad.servlets.painelacompanhamento;


import java.io.IOException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.simple.JSONValue;

import br.com.sigad.persistencia.dao.documento.DocumentoDAO;

/**
 * Servlet implementation class RecuperarDocumentosQueVaoExpirar
 */
@WebServlet("/RecuperarDocumentosQueVaoExpirar")
public class RecuperarDocumentosQueVaoExpirar extends HttpServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		
		DocumentoDAO dao = new DocumentoDAO();
		
		 List<Map<String,String>> recuperarDocumentosQueVaoExpirarComAntecedencia = dao.recuperarDocumentosQueVaoExpirarComAntecedencia(5);
		 String jsonString = JSONValue.toJSONString(recuperarDocumentosQueVaoExpirarComAntecedencia);
		
		
		response.setContentType("text/plain");
		response.setCharacterEncoding("UTF-8");
		response.getWriter().write(jsonString);
	}

}
